<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">    
    <title>圣诞主题</title>
    <link rel='stylesheet' href='common.css' />
    <link rel='stylesheet' href='pageA.css' />
    <link rel="stylesheet" type="text/css" href="pageB.css"> 
    <link rel="stylesheet" type="text/css" href="pageC.css">
    <style type="text/css">
        button:first-of-type{width: 100px;height: 30px;font-size: 15px;position:absolute;z-index: 10;}
    </style>           
    <script src="https://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery.transit/0.9.12/jquery.transit.min.js"></script>    
    <script src="observer.js"></script>    
    <script src="pageC.js"></script>
    <script src="pageB.js"></script>
    <script src="pageA.js"></script>
    <script src="christmas.js"></script>
</head>

<body>
    <section class="container">
        <!-- 第一幅画面 -->
        <section class="page-a bg-adaptive">
            <!-- 月亮 -->
            <figure class="moon"></figure>
            <!-- 圣诞树 -->
            <figure class="tree"></figure>
            <!-- 云 -->
            <figure class="cloudy"></figure>
            <!-- 男孩 -->
            <div class="chs-boy chs-boy-deer"></div>
            <!--
            <svg viewBox="0 0 512 486">
                <defs>
                    <linearGradient id="star" x1="0%" y1="0%" x2="100%" y2="0%">
                        <stop offset="0%" stop-color="#FCF0BC"></stop>
                        <stop offset="0%" stop-color="#FCF0BC"></stop>
                    </linearGradient>
                </defs>
                <polygon style="fill: url(#star);" points="256.814,12.705 317.205,198.566 512.631,198.566 354.529,313.435 414.918,499.295 256.814,384.427 98.713,499.295 159.102,313.435 1,198.566 196.426,198.566 "></polygon>
            </svg>
            -->          
            <!-- 窗户 -->
            <div class="window wood">
                <div class="window-bg"></div>
                <div class="window-content">
                    <div class="window-left"></div>
                    <div class="window-right"></div>
                </div>
            </div>           
        </section>
        <!-- 第二幅画面 -->
        <section class="page-b bg-adaptive">
            <!-- 猫 -->
            <figure class="cat"></figure>
            <!-- 小女孩 -->
            <figure class="girl"></figure>            
            <!-- 圣诞男孩 -->
            <figure class="christmas-boy-head"></figure>
            <figure class="christmas-boy boy-walk"> </figure>            
        </section>
        <!-- 第三幅画面 -->
        <section class="page-c bg-adaptive">
            <!-- 月亮 -->
            <div class="moon"></div>
            <!-- 云 -->
            <div class="cloudy"></div>

            <!-- 星星 -->
            <!--
            <svg viewBox="0 0 512 486">
                <defs>
                    <linearGradient id="star" x1="0%" y1="0%" x2="100%" y2="0%">
                        <stop offset="0%" stop-color="#FCF0BC"></stop>
                        <stop offset="0%" stop-color="#FCF0BC"></stop>
                    </linearGradient>
                </defs>
                <polygon style="fill: url(#star);" points="256.814,12.705 317.205,198.566 512.631,198.566 354.529,313.435 414.918,499.295 256.814,384.427 98.713,499.295 159.102,313.435 1,198.566 196.426,198.566 "></polygon>
            </svg>
            -->
            <!-- 圣诞树 -->
            <figure class="tree treefix"></figure>
            <!-- 鹿 -->
            <figure class="deer"></figure>
            <!-- 窗户关闭 -->
            <div class="window wood">
                <!-- <div class="window-bg"></div> -->
                <div class="window-content" data-attr="red">
                    <div class="window-scene-bg"></div>
                    <div class="window-close-bg"></div>
                    <div class="window-left hover"></div>
                    <div class="window-right hover"></div>
                </div>
            </div>
            <!-- 雪花 -->
            <canvas id="snowflake" style="position:absolute;z-index:999;"></canvas>          
        </section>       
    </section>
    <button>点击开始</button>
<script type="text/javascript">
var config = {};
//rem设置
(function(doc, win) {
    var docEl = doc.documentElement,
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
        recalc = function() {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
            //宽与高度
            var style = "";
            if(clientWidth>=docEl.clientHeight){        
                config.clientWidth = clientWidth;
                config.clientHeight =  clientWidth * (900 / 1440);
            }else{             
               style += "-webkit-transform: rotate(90deg); transform: rotate(90deg);";
              // 注意旋转中点的处理
              style += "-webkit-transform-origin: " + clientWidth / 2 + "px " + clientWidth / 2 + "px;";
              style += "transform-origin: " + clientWidth / 2 + "px " + clientWidth / 2 + "px;"; 
                config.clientWidth = docEl.clientHeight;//clientWidth*1440/900;
                config.clientHeight =  clientWidth;
                document.body.style.width = config.clientWidth + "px";
            }
            document.body.style.height = config.clientHeight + "px";
            //document.body.style.width = config.clientWidth + "px";
            $("button:first").css("top",config.clientHeight/2).css("left",config.clientWidth/2);
            $("body")[0].style.cssText += style; 
            console.log(clientWidth+":"+docEl.clientHeight);
            console.log(config);            
        };
    win.addEventListener(resizeEvt, recalc, false);
    doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
</script>
    <script type="text/javascript" src="snowflake.js"></script>
</body>

</html>